<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>FEUP-Defender: Video</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<link href="../../doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Gerado por Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="../../main.html"><span>Página&nbsp;principal</span></a></li>
      <li><a href="../../modules.html"><span>Módulos</span></a></li>
      <li><a href="../../annotated.html"><span>Estruturas&nbsp;de&nbsp;dados</span></a></li>
      <li><a href="../../files.html"><span>Ficheiros</span></a></li>
      <li><a href="../../dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Video</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Macros</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga9c144bdcde09522969ac89b361b4a8f5"></a><!-- doxytag: member="video::MODE_640x480" ref="ga9c144bdcde09522969ac89b361b4a8f5" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>MODE_640x480</b>&nbsp;&nbsp;&nbsp;0x101</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaef65c7a6075bbec43d02fd99e2d70b66"></a><!-- doxytag: member="video::MODE_800x600" ref="gaef65c7a6075bbec43d02fd99e2d70b66" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>MODE_800x600</b>&nbsp;&nbsp;&nbsp;0x103</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gadf78c5c3bcf227aaa2dc99c368e64184"></a><!-- doxytag: member="video::MODE_1024x768" ref="gadf78c5c3bcf227aaa2dc99c368e64184" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>MODE_1024x768</b>&nbsp;&nbsp;&nbsp;0x105</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaf68035626cbf58484d6b802ed8079dc6"></a><!-- doxytag: member="video::MODE_1280x1024" ref="gaf68035626cbf58484d6b802ed8079dc6" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>MODE_1280x1024</b>&nbsp;&nbsp;&nbsp;0x107</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga31c2e0212158165e0e03cb03957c4336"></a><!-- doxytag: member="video::TRANSPARENTE" ref="ga31c2e0212158165e0e03cb03957c4336" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>TRANSPARENTE</b>&nbsp;&nbsp;&nbsp;-1</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga81a3d7a0f705bb480ce6c96a3c8981f8"></a><!-- doxytag: member="video::COR_DE_TIJOLO" ref="ga81a3d7a0f705bb480ce6c96a3c8981f8" args="" -->
#define&nbsp;</td><td class="memItemRight" valign="bottom"><b>COR_DE_TIJOLO</b>&nbsp;&nbsp;&nbsp;113</td></tr>
<tr><td colspan="2"><h2>Funções</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaf9861b30d851ec90c9104dade57d20ed"></a><!-- doxytag: member="video::get_video_mem_address" ref="gaf9861b30d851ec90c9104dade57d20ed" args="(int mode)" -->
<a class="el" href="../../d8/d7f/group___user_types.html#ga718b4eb2652c286f4d42dc18a8e71a1a">ulong</a>&nbsp;</td><td class="memItemRight" valign="bottom"><b>get_video_mem_address</b> (int mode)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">char *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/de9/group__video.html#ga841cbdaf033ad317f249e57234447b99">enter_graphics</a> (int mode, __dpmi_meminfo *map)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/de9/group__video.html#gafc9db0642f882da2ea7f83f8e26676d2">leave_graphics</a> (__dpmi_meminfo map)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/de9/group__video.html#gac766566a5dad4f67f5b2adaf2020cbdc">set_pixel</a> (int x, int y, int color, char *base)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/de9/group__video.html#ga04b964260ff0cb0c34668ab91ad7f841">get_pixel</a> (int x, int y, char *base)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/de9/group__video.html#gadee257234a20447a677e020e27ae7e7f">clear_screen</a> (char color, char *base)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/de9/group__video.html#ga23674a1e5b90e122191a9f7993e4f7ee">draw_line</a> (int xi, int yi, int xf, int yf, int color, char *base)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga52096e44f25b3d62a5feaf2caebac73e"></a><!-- doxytag: member="video::drawCharAt" ref="ga52096e44f25b3d62a5feaf2caebac73e" args="(char c, int x, int y, int fore_color, int back_color, int char_scale, char *video_base, char *table)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>drawCharAt</b> (char c, int x, int y, int fore_color, int back_color, int char_scale, char *video_base, char *table)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gac3f02d237817131af3e28fe5ba3f5a4d"></a><!-- doxytag: member="video::drawCharCenteredAt" ref="gac3f02d237817131af3e28fe5ba3f5a4d" args="(char c, int x, int y, int fore_color, int back_color, int char_scale, char *video_base, char *table)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>drawCharCenteredAt</b> (char c, int x, int y, int fore_color, int back_color, int char_scale, char *video_base, char *table)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga1290934f0da6287682d2f7a62b13110e"></a><!-- doxytag: member="video::drawStringAt" ref="ga1290934f0da6287682d2f7a62b13110e" args="(char *str, int x, int y, int fore_color, int back_color, int char_scale, char *video_base, char *table)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>drawStringAt</b> (char *str, int x, int y, int fore_color, int back_color, int char_scale, char *video_base, char *table)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gac2a586b3ec26c71b5691bd338d2aea0f"></a><!-- doxytag: member="video::drawIntAt" ref="gac2a586b3ec26c71b5691bd338d2aea0f" args="(int num, int x, int y, int fore_color, int back_color, int char_scale, char *video_base, char *table)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>drawIntAt</b> (int num, int x, int y, int fore_color, int back_color, int char_scale, char *video_base, char *table)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga32538900cd0ccb26edc0f2811bb8c327"></a><!-- doxytag: member="video::draw_rectangle" ref="ga32538900cd0ccb26edc0f2811bb8c327" args="(int xi, int yi, int xf, int yf, int espessura, int line_color, int back_color, char *base)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>draw_rectangle</b> (int xi, int yi, int xf, int yf, int espessura, int line_color, int back_color, char *base)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaad715625ea0d7da0a8c5094d8adfd49c"></a><!-- doxytag: member="video::draw_rect" ref="gaad715625ea0d7da0a8c5094d8adfd49c" args="(int xi, int yi, int xf, int yf, int line_color, char *base)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>draw_rect</b> (int xi, int yi, int xf, int yf, int line_color, char *base)</td></tr>
<tr><td colspan="2"><h2>Variáveis</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/de9/group__video.html#ga2a60090435aefe2530692883c79d9bb8">HRES</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d7/de9/group__video.html#ga02a30657228763729d9e2351a0b6bcba">VRES</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaafb5c862fb547ae14a4fd5f79f8f369a"></a><!-- doxytag: member="video::VIDEO_MEM" ref="gaafb5c862fb547ae14a4fd5f79f8f369a" args="" -->
<a class="el" href="../../d8/d7f/group___user_types.html#ga718b4eb2652c286f4d42dc18a8e71a1a">ulong</a>&nbsp;</td><td class="memItemRight" valign="bottom"><b>VIDEO_MEM</b></td></tr>
</table>
<hr/><a name="_details"></a><h2>Descrição detalhada</h2>
<p>Entering/leaving/utility video functions </p>
<hr/><h2>Documentação das funções</h2>
<a class="anchor" id="gadee257234a20447a677e020e27ae7e7f"></a><!-- doxytag: member="video&#45;graphics.h::clear_screen" ref="gadee257234a20447a677e020e27ae7e7f" args="(char color, char *base)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void clear_screen </td>
          <td>(</td>
          <td class="paramtype">char&nbsp;</td>
          <td class="paramname"> <em>color</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>base</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Set graphics memory at memory address "base" to "color". </p>

<p>Definido na linha <a class="el" href="../../#L97">97</a> do ficheiro <a class="el" href="../../">video-graphics.c</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00098"></a>00098 {
<a name="l00099"></a>00099         <span class="keywordtype">int</span> x, y;
<a name="l00100"></a>00100         <span class="keywordflow">for</span>(y = 0; y &lt; <a class="code" href="../../d7/de9/group__video.html#ga02a30657228763729d9e2351a0b6bcba">VRES</a>; y++)
<a name="l00101"></a>00101                 <span class="keywordflow">for</span>(x = 0; x &lt; <a class="code" href="../../d7/de9/group__video.html#ga2a60090435aefe2530692883c79d9bb8">HRES</a>; x++)
<a name="l00102"></a>00102                         <a class="code" href="../../d7/de9/group__video.html#gac766566a5dad4f67f5b2adaf2020cbdc">set_pixel</a>(x, y, color, base);
<a name="l00103"></a>00103 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="ga23674a1e5b90e122191a9f7993e4f7ee"></a><!-- doxytag: member="video&#45;graphics.h::draw_line" ref="ga23674a1e5b90e122191a9f7993e4f7ee" args="(int xi, int yi, int xf, int yf, int color, char *base)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void draw_line </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>xi</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>yi</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>xf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>yf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>color</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>base</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Draw a line of color "color" between point (xi,yi) and (xf,yf) at memory address "base" </p>

<p>Definido na linha <a class="el" href="../../#L108">108</a> do ficheiro <a class="el" href="../../">video-graphics.c</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00109"></a>00109 {
<a name="l00110"></a>00110         <span class="comment">//obter o comprimento da linha em x</span>
<a name="l00111"></a>00111         <span class="keywordtype">int</span> x_size = xf - xi;
<a name="l00112"></a>00112         <span class="keywordflow">if</span>(x_size &lt; 0) x_size = -x_size;
<a name="l00113"></a>00113         
<a name="l00114"></a>00114         <span class="comment">//obter o comprimento da linha em y</span>
<a name="l00115"></a>00115         <span class="keywordtype">int</span> y_size = yf - yi;
<a name="l00116"></a>00116         <span class="keywordflow">if</span>(y_size &lt; 0) y_size = -y_size;
<a name="l00117"></a>00117         
<a name="l00118"></a>00118         <span class="keywordtype">int</span> i;
<a name="l00119"></a>00119         <span class="keywordflow">if</span>(x_size &gt; y_size) <span class="comment">//dimensao maior e a horizontal</span>
<a name="l00120"></a>00120         {
<a name="l00121"></a>00121                 <span class="keywordflow">if</span>(xf - xi &lt; 0) <span class="comment">//orientar a recta no sentido positivo de x</span>
<a name="l00122"></a>00122                 {
<a name="l00123"></a>00123                         <span class="keywordtype">int</span> aux = xi;
<a name="l00124"></a>00124                         xi = xf;
<a name="l00125"></a>00125                         xf = aux;
<a name="l00126"></a>00126                         aux = yi;
<a name="l00127"></a>00127                         yi = yf;
<a name="l00128"></a>00128                         yf = aux;
<a name="l00129"></a>00129                 }
<a name="l00130"></a>00130                 
<a name="l00131"></a>00131                 <span class="keywordflow">for</span>(i = 0; i &lt;= x_size; i++)
<a name="l00132"></a>00132                 {
<a name="l00133"></a>00133                         <span class="comment">//regra de 3 simples; se x_size esta para y_size, entao i esta para y_point</span>
<a name="l00134"></a>00134                         <span class="keywordtype">double</span> y_point = (double)y_size * (<span class="keywordtype">double</span>)i / (double)x_size;
<a name="l00135"></a>00135                         
<a name="l00136"></a>00136                         <span class="comment">//desenhar pixel</span>
<a name="l00137"></a>00137                         <span class="keywordflow">if</span>(yf - yi &lt; 0) <a class="code" href="../../d7/de9/group__video.html#gac766566a5dad4f67f5b2adaf2020cbdc">set_pixel</a>(xi + i, yi - (<span class="keywordtype">int</span>)(y_point + 0.5), color, base);
<a name="l00138"></a>00138                         <span class="keywordflow">else</span> <a class="code" href="../../d7/de9/group__video.html#gac766566a5dad4f67f5b2adaf2020cbdc">set_pixel</a>(xi + i, yi + (<span class="keywordtype">int</span>)(y_point + 0.5), color, base);
<a name="l00139"></a>00139                 }
<a name="l00140"></a>00140         }
<a name="l00141"></a>00141                 
<a name="l00142"></a>00142         <span class="keywordflow">else</span> <span class="comment">//dimensao maior e a vertical</span>
<a name="l00143"></a>00143         {
<a name="l00144"></a>00144                 <span class="keywordflow">if</span>(yf - yi &lt; 0) <span class="comment">//orientar a recta no sentido positivo de y</span>
<a name="l00145"></a>00145                 {
<a name="l00146"></a>00146                         <span class="keywordtype">int</span> aux = xi;
<a name="l00147"></a>00147                         xi = xf;
<a name="l00148"></a>00148                         xf = aux;
<a name="l00149"></a>00149                         aux = yi;
<a name="l00150"></a>00150                         yi = yf;
<a name="l00151"></a>00151                         yf = aux;
<a name="l00152"></a>00152                 }
<a name="l00153"></a>00153                 
<a name="l00154"></a>00154                 <span class="keywordflow">for</span>(i = 0; i &lt;= y_size; i++)
<a name="l00155"></a>00155                 {
<a name="l00156"></a>00156                         <span class="comment">//regra de 3 simples; se y_size esta para x_size, entao i esta para x_point</span>
<a name="l00157"></a>00157                         <span class="keywordtype">double</span> x_point = (double)x_size * (<span class="keywordtype">double</span>)i / (double)y_size;
<a name="l00158"></a>00158                         
<a name="l00159"></a>00159                         <span class="comment">//desenhar pixel</span>
<a name="l00160"></a>00160                         <span class="keywordflow">if</span>(xf - xi &lt; 0) <a class="code" href="../../d7/de9/group__video.html#gac766566a5dad4f67f5b2adaf2020cbdc">set_pixel</a>(xi - (<span class="keywordtype">int</span>)(x_point + 0.5), yi + i, color, base);
<a name="l00161"></a>00161                         <span class="keywordflow">else</span> <a class="code" href="../../d7/de9/group__video.html#gac766566a5dad4f67f5b2adaf2020cbdc">set_pixel</a>(xi + (<span class="keywordtype">int</span>)(x_point + 0.5), yi + i, color, base);
<a name="l00162"></a>00162                 }
<a name="l00163"></a>00163         }               
<a name="l00164"></a>00164 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="ga841cbdaf033ad317f249e57234447b99"></a><!-- doxytag: member="video&#45;graphics.h::enter_graphics" ref="ga841cbdaf033ad317f249e57234447b99" args="(int mode, __dpmi_meminfo *map)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* enter_graphics </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>mode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">__dpmi_meminfo *&nbsp;</td>
          <td class="paramname"> <em>map</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Enter graphics mode, enabling near pointers and mapping video physical memory to program virtual address.</p>
<p>Returns a generic pointer pointing to video memory address or NULL on error. "mode" specifies the VESA graphics mode to use, and the mapping information is returned through "map".</p>
<p>Also initializes two global variables, VRES and HRES, </p>

<p>Definido na linha <a class="el" href="../../#L37">37</a> do ficheiro <a class="el" href="../../">video-graphics.c</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00038"></a>00038 {
<a name="l00039"></a>00039         <span class="comment">//gera interrupcao de software 0x10 com os registos indicados, activando o modo grafico</span>
<a name="l00040"></a>00040         __dpmi_regs regs;
<a name="l00041"></a>00041         regs.x.ax = 0x4F02; <span class="comment">//AX especifica a rotina de mudanca do modo da placa</span>
<a name="l00042"></a>00042         regs.x.bx = 0x4000 + mode; <span class="comment">//BX especifica o modo grafico, com o bit 14 a 1</span>
<a name="l00043"></a>00043         __dpmi_int(0x10, &amp;regs); <span class="comment">//interrupcao - entrar no modo grafico</span>
<a name="l00044"></a>00044         
<a name="l00045"></a>00045         VIDEO_MEM = get_video_mem_address(mode); <span class="comment">//obter endereco da memoria video</span>
<a name="l00046"></a>00046         
<a name="l00047"></a>00047         <span class="comment">//inicializar/actualizar variaveis HRES e VRES</span>
<a name="l00048"></a>00048         <span class="keywordflow">if</span>(mode == MODE_640x480) { <a class="code" href="../../d7/de9/group__video.html#ga2a60090435aefe2530692883c79d9bb8">HRES</a> = 640; <a class="code" href="../../d7/de9/group__video.html#ga02a30657228763729d9e2351a0b6bcba">VRES</a> = 480; }
<a name="l00049"></a>00049         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(mode == MODE_800x600) { <a class="code" href="../../d7/de9/group__video.html#ga2a60090435aefe2530692883c79d9bb8">HRES</a> = 800; <a class="code" href="../../d7/de9/group__video.html#ga02a30657228763729d9e2351a0b6bcba">VRES</a> = 600; }
<a name="l00050"></a>00050         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(mode == MODE_1024x768) { <a class="code" href="../../d7/de9/group__video.html#ga2a60090435aefe2530692883c79d9bb8">HRES</a> = 1024; <a class="code" href="../../d7/de9/group__video.html#ga02a30657228763729d9e2351a0b6bcba">VRES</a> = 768; }
<a name="l00051"></a>00051         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(mode == MODE_1280x1024) { <a class="code" href="../../d7/de9/group__video.html#ga2a60090435aefe2530692883c79d9bb8">HRES</a> = 1280; <a class="code" href="../../d7/de9/group__video.html#ga02a30657228763729d9e2351a0b6bcba">VRES</a> = 1024; }
<a name="l00052"></a>00052         
<a name="l00053"></a>00053         __djgpp_nearptr_enable(); <span class="comment">//permite acesso a memoria fisica usando apontadores</span>
<a name="l00054"></a>00054         map-&gt;address = VIDEO_MEM; <span class="comment">//endereco fisico da memoria video</span>
<a name="l00055"></a>00055         map-&gt;size = <a class="code" href="../../d7/de9/group__video.html#ga2a60090435aefe2530692883c79d9bb8">HRES</a> * <a class="code" href="../../d7/de9/group__video.html#ga02a30657228763729d9e2351a0b6bcba">VRES</a>; <span class="comment">//tamanho do bloco de memoria (cada pixel ocupa um byte na memoria)</span>
<a name="l00056"></a>00056         __dpmi_physical_address_mapping(map); <span class="comment">//mapear bloco de memoria pretendido</span>
<a name="l00057"></a>00057         
<a name="l00058"></a>00058         <span class="keywordflow">return</span> (<span class="keywordtype">char</span>*)(map-&gt;address + __djgpp_conventional_base); <span class="comment">//retornar endereco generico a usar</span>
<a name="l00059"></a>00059         
<a name="l00060"></a>00060 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="ga04b964260ff0cb0c34668ab91ad7f841"></a><!-- doxytag: member="video&#45;graphics.h::get_pixel" ref="ga04b964260ff0cb0c34668ab91ad7f841" args="(int x, int y, char *base)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int get_pixel </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>base</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Returns the pixel color at screen coordinates x, y at memory address "base" </p>

<p>Definido na linha <a class="el" href="../../#L89">89</a> do ficheiro <a class="el" href="../../">video-graphics.c</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00090"></a>00090 {
<a name="l00091"></a>00091         <span class="keywordflow">if</span>(x &lt; 0 || x &gt;= <a class="code" href="../../d7/de9/group__video.html#ga2a60090435aefe2530692883c79d9bb8">HRES</a> || y &lt; 0 || y &gt;= <a class="code" href="../../d7/de9/group__video.html#ga02a30657228763729d9e2351a0b6bcba">VRES</a>) <span class="keywordflow">return</span> -1;
<a name="l00092"></a>00092         <span class="keywordflow">return</span> (<span class="keywordtype">int</span>)(*(base + y*<a class="code" href="../../d7/de9/group__video.html#ga2a60090435aefe2530692883c79d9bb8">HRES</a> + x));
<a name="l00093"></a>00093 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="gafc9db0642f882da2ea7f83f8e26676d2"></a><!-- doxytag: member="video&#45;graphics.h::leave_graphics" ref="gafc9db0642f882da2ea7f83f8e26676d2" args="(__dpmi_meminfo map)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void leave_graphics </td>
          <td>(</td>
          <td class="paramtype">__dpmi_meminfo&nbsp;</td>
          <td class="paramname"> <em>map</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Unmap video memory, disable near pointer and returns to text mode </p>

<p>Definido na linha <a class="el" href="../../#L66">66</a> do ficheiro <a class="el" href="../../">video-graphics.c</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00067"></a>00067 {
<a name="l00068"></a>00068         __dpmi_free_physical_address_mapping(&amp;map); <span class="comment">//liberta mapeamento</span>
<a name="l00069"></a>00069         __djgpp_nearptr_disable(); <span class="comment">//desactivar acesso a memoria fisica usando apontadores</span>
<a name="l00070"></a>00070         
<a name="l00071"></a>00071         __dpmi_regs regs;
<a name="l00072"></a>00072         regs.x.ax = 0x0003;
<a name="l00073"></a>00073         __dpmi_int(0x10, &amp;regs); <span class="comment">//gera interrupcao software 0x10, entrando no modo texto</span>
<a name="l00074"></a>00074 }
</pre></div></p>

</div>
</div>
<a class="anchor" id="gac766566a5dad4f67f5b2adaf2020cbdc"></a><!-- doxytag: member="video&#45;graphics.h::set_pixel" ref="gac766566a5dad4f67f5b2adaf2020cbdc" args="(int x, int y, int color, char *base)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void set_pixel </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>color</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>base</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Draws a pixel of color "color" at screen coordinates x, y at memory address "base" </p>

<p>Definido na linha <a class="el" href="../../#L79">79</a> do ficheiro <a class="el" href="../../">video-graphics.c</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00080"></a>00080 {
<a name="l00081"></a>00081         <span class="keywordflow">if</span>(x &lt; 0 || x &gt;= <a class="code" href="../../d7/de9/group__video.html#ga2a60090435aefe2530692883c79d9bb8">HRES</a> || y &lt; 0 || y &gt;= <a class="code" href="../../d7/de9/group__video.html#ga02a30657228763729d9e2351a0b6bcba">VRES</a>) <span class="keywordflow">return</span>;
<a name="l00082"></a>00082         <span class="keywordflow">if</span> (color != TRANSPARENTE)
<a name="l00083"></a>00083                 *(base + y*<a class="code" href="../../d7/de9/group__video.html#ga2a60090435aefe2530692883c79d9bb8">HRES</a> + x) = color;
<a name="l00084"></a>00084 }
</pre></div></p>

</div>
</div>
<hr/><h2>Documentação das variáveis</h2>
<a class="anchor" id="ga2a60090435aefe2530692883c79d9bb8"></a><!-- doxytag: member="video&#45;graphics.h::HRES" ref="ga2a60090435aefe2530692883c79d9bb8" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="../../d7/de9/group__video.html#ga2a60090435aefe2530692883c79d9bb8">HRES</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>global variable with the horizontal resolution in pixels </p>

<p>Definido na linha <a class="el" href="../../#L3">3</a> do ficheiro <a class="el" href="../../">video-graphics.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga02a30657228763729d9e2351a0b6bcba"></a><!-- doxytag: member="video&#45;graphics.h::VRES" ref="ga02a30657228763729d9e2351a0b6bcba" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="../../d7/de9/group__video.html#ga02a30657228763729d9e2351a0b6bcba">VRES</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>global variable with the vertical resolution in pixels </p>

<p>Definido na linha <a class="el" href="../../#L3">3</a> do ficheiro <a class="el" href="../../">video-graphics.c</a>.</p>

</div>
</div>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Gerado em Tue Jun 1 22:05:39 2010 para FEUP-Defender por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
